
package xib.parserTools.interfaces;

import java.util.ArrayList;
import xib.utils.EncodedString;
import xib.utils.XibDataException;

/**
 * This interface defined all the functions needed to save properly all the
 * information about the Chapter from the source.
 * @author xavierds
 */
public interface IChapterData {

    /**
     * Returns the list of EncodedString with the titles of this IChapterData in
     * the differents languages. The list of titles is never going to be empty.
     * @return The list of EncodedString with the titles from the Chapter.
     * @throws XibDataException If the list of titles wasn't initialized properly.
     */
    public ArrayList<EncodedString> getTitles();

    /**
     * Returns the list of Pages from this IChapterData. This list is never
     * going to be empty.
     * @return The list of Pages with the IPageData from this Chapter.
     * @throws XibDataException If the list of pages is not initialized properly.
     */
    ArrayList<IPageData> getPages();

    /**
     * Returns the chapter number of this IChapterData.
     * @return An integer with the number of this chapter.
     */
    public int getChapterNumber();

    /**
     * Add a title in a specific language in this IChapterData. The given
     * title and language can not be null or the empty String.
     * @param title A String with the new title to add to the Chapter.
     * @param language A tring with the language of the new title to add.
     * @throws XibDataException If the given title or language is null or an
     * empty String.
     */
    public void addTitle(String title, String language);

    /**
     * Add a IPageData in this IChapterData. The given IPageData can not be null.
     * @param pd An IPageData correctly initialized.
     * @throws XibDataException If the given page is null or is already
     * defined in this Chapter.
     * 
     */
    void addPage(IPageData pd);

    /**
     * Set the chapter number of this IChapterNumber.
     * @param chapterNumber An integer with the number of the Chapter.
     */
    void setChapterNumber(int chapterNumber);



    /**
     * Returns true if the data of the IChapterData is initialized properly.
     * @return A boolean
     * @throws XibDataException If the height, width or some IPanelData aren't
     * defined properly.
     */
    boolean validate();

}
